package ld.oauth.blog.service.user;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ld.common.ResultInfoFactory;
import ld.oauth.blog.model.bo.CheckOldPasswordBo;
import ld.oauth.blog.model.bo.SysUserBo;
import ld.oauth.blog.model.po.user.SysUser;
import ld.oauth.blog.model.qo.UserArticleQo;
import ld.oauth.blog.model.vo.UserArticleVo;
import ld.oauth.blog.model.vo.UserQuestionVo;
import ld.oauth.blog.utils.PageResult;

/**
 * <p>
 * 用户表 服务类
 * </p>
 *
 * @author
 * @since 2022-08-29
 */
public interface SysUserService extends IService<SysUser> {


    SysUser findByMobile(String mobile);

    SysUser findByName(String name);


    IPage<SysUser> selectPage(Page<SysUser> page, SysUser sysUser);

    SysUser findById(Long id);

    Boolean deleteByUserId(Long userId);

    /**
     * 修改用户信息
     * @param sysUserBo
     * @return
     */
    Boolean saveOrUpdateUserBo(SysUserBo sysUserBo);

    /**
     * 分页条件查询用户的文章信息
     * @param userArticleQo
     * @return
     */
    PageResult<UserArticleVo> articlePageQuery(UserArticleQo userArticleQo);

    /**
     * 分页条件查询用户的问题信息
     * @param userArticleQo
     * @return
     */
    PageResult<UserQuestionVo> questionPageQuery(UserArticleQo userArticleQo);

    /**
     * 校验旧密码是否正确
     * @param checkOldPasswordBo
     * @return
     */
    ResultInfoFactory checkOldPassword(CheckOldPasswordBo checkOldPasswordBo);

    /**
     * 修改密码
     * @param checkOldPasswordBo
     * @return
     */
    ResultInfoFactory updatePassword(CheckOldPasswordBo checkOldPasswordBo);
}
